$(function () {
  // console.log('hello world!');
  // window.innerHeight

  let $main = $('#main');
  $main.css({
    height: `${window.innerHeight}`
  })

  var map = new BMap.Map("main");    // 创建Map实例
  map.centerAndZoom(new BMap.Point(114.529963, 38.003679), 25);  // 初始化地图,设置中心点坐标和地图级别
  //添加地图类型控件
  map.addControl(new BMap.MapTypeControl({
    mapTypes: [
      BMAP_NORMAL_MAP,
      BMAP_HYBRID_MAP,
      // BMAP_SATELLITE_MAP
    ]
  }));
  map.setCurrentCity("石家庄");          // 设置地图显示的城市 此项是必须设置的
  map.enableScrollWheelZoom(false);     //开启鼠标滚轮缩放
  // BMap.Marker({title:"SPA 富应用开发"})
  let position = new BMap.Point(114.529963, 38.003679);
  let title = new BMap.Marker(position, { title: "SPA 富应用开发" });
  title.setAnimation(BMAP_ANIMATION_BOUNCE);
  map.addOverlay(title);

  let reat = new BMap.InfoWindow('<div style="width: 250px"><p>时间：周二、周四下午<br>地点：505 教室</p><a href="https://github.com/wangding" target="_blank"><img src="https://secure.gravatar.com/avatar/4e1b831efef47d65a762da5d5e89174c?s=250" alt="王顶" width="40px" height="40px" style="position: relative; top: -58px; left: 190px"></a></div>', { width: 230, height: 100, title: "<strong>SPA 富应用开发</strong>" });
  title.openInfoWindow(reat);
  title.addEventListener("click", function () { map.openInfoWindow(reat, position) })
});
